function dialog(options = {}) {
  const page = getPage()
  const component = page.selectComponent('#user-status-dialog')
  if (!component) {
    console.warn("组件未注册");
    return
  }
  component.clean()
  if (options.confirm) {
    component.myData.confirm = options.confirm
  }
  if (options.cancel) {
    component.myData.cancel = options.cancel
  }
  if (options.dialog) {
    component.setData({
      dialog: options.dialog,
      isKeep: options.isKeep || false,
    })
  }
}

function getPage() {
  return getCurrentPages() ? getCurrentPages()[getCurrentPages().length - 1] : {}
}

export {
  dialog,
}